<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp" %>
<div class="body" style="position: relative">
    <div style="position: absolute;left: 20px;top:10px ; width: 70px; text-align: center;color: #47a6f5;cursor:pointer;border: 1px solid  #47a6f5;line-height: 28px"
         onclick="manage_sys_opens('中心机房','/manage/demo/powerPage/tosecondaryPages.html')">返回</div>
<div class="container"><div class="EMStop1"></div></div>
<div class="container1">
    <div class="EMSUspContent"><p class="EMStitle" style="position: absolute;top:40px ;position: relative">红外人体活动探测器</p>
        <div class="content">
            <div class="left">
                <div class="upsSd" style=" background-image: url('/manage/assert/image/xinfeng.png');">
                    <div class="loading" id="box">

                    </div>
                </div>
                <p>开机状态 :<span class="linkSuccess"></span></p>
            </div>
            <div style="overflow: hidden;width:69% ">
                <div class="right" style="height: 380px; width:calc(100% + 19px);overflow: auto;font-size: 18px">
         <%--   <div style="height: 300px;">
                <div class="right" style="height: 70px;margin-top: 115px">--%>

                <table id="humanActiveInfrared_table" border="2">
                    <tr>
                        <td class="blueBg">设备状态</td>
                        <td ><span name="state"></span></td>
                        <td class="blueBg">传感器状态</td>
                        <td><span name="sensorstate"></span></td>
                    </tr>
                    <tr>
                        <td class="blueBg">电池状态</td>
                        <td><span name="batterystate"></span></td>
                        <td class="blueBg">防拆状态</td>
                        <td><span name="tamperstate"></span></td>
                    </tr>
                    <tr>
                        <td class="blueBg">按键状态</td>
                        <td><span name="keystate"></span></td>
                        <td class="blueBg">crc16高字节</td>
                        <td><span name="crchighbytes"></span></td>
                    </tr>
                    <tr>
                        <td class="blueBg">crc16低字节</td>
                        <td><span name="crclowhbytes"></span></td>
                        <td class="blueBg">帧尾</td>
                        <td><span name="frametail"></span></td>
                    </tr>

                </table>
                </div>
            </div>
        </div>
    </div>
</div>

</div>
<script>
    $(function () {
        var count = 0;
        var t = setInterval(function () {
            var $redDiv = $("#box").find(".greenBg");
            if(count === 15){
                count=-1;
                $("#box").find('.greenBg').removeClass('greenBg').addClass('white');
                $redDiv=$("#box").find(".first");
                $("#box").find(".last").removeClass("greenBg").addClass("white");
            }
            $redDiv.next().removeClass("white").addClass("greenBg");
            count++;
        }, 1000);
       // if($.websocket.socketMsgs) {
            var entity = $.websocket.hwrtall
           // var entity = JSON.parse(socketMsg.entity)
            if (entity.equipmentid == $.websocket.hwrt) {//红外人体
                if(entity.state=='00'){
                    $("#humanActiveInfrared_table span[name='state']").text('正常');
                    $("#humanActiveInfrared_table span[name='state']").css('color','#00ff0c');
                }else if(entity.state=='01') {
                    $("#humanActiveInfrared_table span[name='state']").text('报警');
                }else {
                    $("#humanActiveInfrared_table span[name='state']").text('保留');
                }

                if(entity.sensorstate=='00'){
                    $("#humanActiveInfrared_table span[name='sensorstate']").text('正常');
                    $("#humanActiveInfrared_table span[name='sensorstate']").css('color','#00ff0c');
                }else if(entity.sensorstate=='01') {
                    $("#humanActiveInfrared_table span[name='sensorstate']").text('故障');
                } else {
                    $("#humanActiveInfrared_table span[name='sensorstate']").text('保留');
                }
                if(entity.batterystate=='00'){
                    $("#humanActiveInfrared_table span[name='batterystate']").text('正常');
                    $("#humanActiveInfrared_table span[name='batterystate']").css('color','#00ff0c');
                }else if(entity.batterystate=='01') {
                    $("#humanActiveInfrared_table span[name='batterystate']").text('低电');
                }else {
                    $("#humanActiveInfrared_table span[name='batterystate']").text('保留');
                }
                if(entity.tamperstate=='0'){
                    $("#humanActiveInfrared_table span[name='tamperstate']").text('正常');
                    $("#humanActiveInfrared_table span[name='tamperstate']").css('color','#00ff0c');
                }else if(entity.tamperstate=='1') {
                    $("#humanActiveInfrared_table span[name='tamperstate']").text('被拆');
                }else {
                    $("#infraredinduction_table span[name='tamperstate']").text('保留');
                }
                if(entity.keystate=='000'){
                    $("#humanActiveInfrared_table span[name='keystate']").text('正常');
                    $("#humanActiveInfrared_table span[name='keystate']").css('color','#00ff0c');
                }else if(entity.keystate=='001') {
                    $("#humanActiveInfrared_table span[name='keystate']").text('测试');
                }else {
                    $("#humanActiveInfrared_table span[name='keystate']").text('保留');
                }
                $("#humanActiveInfrared_table span[name='crchighbytes']").text(entity.crchighbytes);
                $("#humanActiveInfrared_table span[name='crclowhbytes']").text(entity.crclowhbytes);
                $("#humanActiveInfrared_table span[name='frametail']").text(entity.frametail);
            }
        //}

    });
</script>